﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OnTheWay.Interfaces;
using OnTheWay.Models;

namespace BlackMofo.BLL.Impls
{
    public class BLLImpl<T> : IObjectBehaviors<T, Guid> where T : OnTheWay.Models.Model
    {
        /// <summary>
        /// EqCheck的DAL接口
        /// </summary>
        IObjectBasicBehaviors<T, Guid> DALImpl = new DAL.DALUtil<T>();

        /// <summary>
        /// 向数据库写入EqCheck数据
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="model">待写入数据库的对象</param>
        /// <returns>写入成功返回,则返回true,否则返回false</returns>
        public virtual bool Insert(Guid authid, T model)
        {
            return DALImpl.Insert(model);
        }

        /// <summary>
        /// 更新EqCheck对象数据
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="model">待更新的对象</param>
        /// <returns>更新成功返回,则返回true,否则返回false</returns>
        public virtual bool Update(Guid authid, T model)
        {
            return DALImpl.Update(model);
        }

        /// <summary>
        /// 删除EqCheck对象数据
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="model">待删除的对象</param>
        /// <returns>删除成功返回,则返回true,否则返回false</returns>
        public virtual bool Delete(Guid authid, T model)
        {
            return DALImpl.Delete(model);
        }

        /// <summary>
        /// 根据EqCheck对象ID获取对象
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="id">待获取对象的ID</param>
        /// <returns>待获取对象或null</returns>
        public virtual T GetByID(Guid authid, Guid id)
        {
            return DALImpl.GetByID(id);
        }

        /// <summary>
        /// 更新EqCheck对象列表
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="list">待更新的EqCheck对象列表</param>
        /// <returns>更新成功返回,则返回true,否则返回false</returns>
        public virtual bool UpdateList(Guid authid, IList<T> list)
        {
            return DALImpl.UpdateList(list);
        }

        /// <summary>
        /// 根据提供的ID判断EqCheck对象是否存在
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="id">EqCheck对象ID</param>
        /// <returns>EqCheck对象存在,则返回true,否则返回false</returns>
        public virtual bool Exists(Guid authid, Guid id)
        {
            return DALImpl.Exists(id);
        }

        /// <summary>
        /// 删除EqCheck列表
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="list">待删除的EqCheck列表</param>
        /// <returns>删除成功返回,则返回true,否则返回false</returns>
        public virtual bool DeleteList(Guid authid, IList<T> list)
        {
            return DALImpl.DeleteList(list);
        }

        /// <summary>
        /// 根据EqCheck对象ID删除对象
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="id">待删除EqCheck对象的ID</param>
        /// <returns></returns>
        public virtual bool DeleteByID(Guid authid, Guid id)
        {
            return DALImpl.DeleteByID(id);
        }

        /// <summary>
        /// 统计EqCheck对象的个数
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="where">统计条件</param>
        /// <returns>符合条件的EqCheck对象列表个数</returns>
        public virtual long GetRecordCount(Guid authid, string where)
        {
            return DALImpl.GetRecordCount(where);
        }

        /// <summary>
        /// 以分页形式获取符合条件的EqCheck对象列表
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="where">筛选条件</param>
        /// <param name="page">分页信息</param>
        /// <returns>符合指定条件的EqCheck对象列表</returns>
        public virtual IList<T> GetListByPage(Guid authid, string where, Page page)
        {
            return DALImpl.GetListByPage(where, page);
        }

        /// <summary>
        /// 获取符合条件的EqCheck对象列表
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="where">筛选条件</param>
        /// <param name="order">排序字段</param>
        /// <param name="asc">升序或降序</param>
        /// <returns>符合指定条件的EqCheck对象列表</returns>
        public virtual IList<T> GetListWhere(Guid authid, string where, string order, string asc)
        {
            return DALImpl.GetListWhere(where, order, asc);
        }

        /// <summary>
        /// 获取无效EqCheck对象列表
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <returns>符合指定条件的EqCheck对象列表</returns>
        public virtual IList<T> GetInValidData(Guid authid)
        {
            return DALImpl.GetInValidData();
        }

        /// <summary>
        /// 以分页形式获取无效EqCheck对象列表
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="page">分页信息</param>
        /// <returns>符合指定条件的EqCheck对象列表</returns>
        public virtual IList<T> GetInValidDataPage(Guid authid, Page page)
        {
            return DALImpl.GetInValidDataPage(page);
        }
    }
}
